<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>入门</title>
    <style>
        html,
        body {
            width: 100%;
            height: 100%;
        }

        img {
            width: 100%;
            height: 100%;
            position: absolute;
        }

        .say {
            width: 200px;
            height: 200px;

        }

        #content {
            width: 200px;
            height: 200px;
            position: absolute;
            text-align: center;
            line-height: 150px;
        }
    </style>
</head>

<body>
    <img src="image/大聪明.webp" alt="">
    <img src="image/对话框.webp" alt="" class="say">
    <div id="content"></div>
    <script>
        var inputs = prompt("请输入一个奇数\n然后开始计算")
        function calculate(n) {
            var n = n
            var k = 0
            var i = 1
            for (; i <= n; i += 2) {
                k += i
                if (i > n - 2) {
                    return k
                }
            }
        }
        content.innerHTML = ("1到" + inputs + "的奇数和是" + "\n" + calculate(inputs))

    </script>
</body>

</html>